﻿@{
    ViewBag.Title = "ChucNang";
    Layout = "~/Views/Shared/Admin/_AdminLayout.cshtml";
}

@using PagedList
@using PagedList.Mvc
@{
    ViewBag.Title = "ChucNang";
    Layout = "~/Views/Shared/Admin/_AdminLayout.cshtml";
}

@using PagedList
@using PagedList.Mvc
<div id="content" class="span10">
    <!-- content starts -->
    <div>
        <ul class="breadcrumb">
            <li>
                <a href="#">Home</a> <span class="divider">/</span>
            </li>
            <li>
                <a href="#">Danh sách user</a>
            </li>
        </ul>
    </div>
    <div class="row-fluid sortable">
        <div class="box span12">
            <div class="box-content">
                <div class="row-fluid">
                    <div class="span10">
                        @using (Html.BeginForm())
                        {
                            <table>
                                <tr>
                                    <td colspan="2">@ViewBag.ThongBao</td>
                                </tr>
                                <tr class="row">
                                    <td class="box_title">Tên chức năng
                                    </td>
                                    <td class="box_object">
                                        <input type="hidden" name="txtID" id="txtID" class="input_text" style="width: 300px" value="@ViewBag.Id" />
                                        <input type="text" name="txtTen" id="txtTen" class="input_text" style="width: 300px" value="@ViewBag.Ten" />
                                    </td>
                                </tr>
                                <tr class="row">
                                    <td class="box_title">Mã
                                    </td>
                                    <td class="box_object">
                                        <input type="text" name="txtCode" id="txtCode" class="input_text" style="width: 300px" value="@ViewBag.Ma" />
                                        (vd: xoa_san_pham)
                                    </td>
                                </tr>
                                <tr class="row">
                                    <td class="box_title"></td>
                                    <td class="box_object">
                                        <input type="submit" name="luu" class="btn btn-primary" value="Lưu">

                                    </td>
                                </tr>
                            </table>
                        }

                    </div>
                </div>
            </div>
            <div class="clearfix"></div>
            <table class="table table-striped table-bordered bootstrap-datatable datatable">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>Tên</th>
                        <th>Mã</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var chucnang in ViewBag.OnePage)
                    {
                        <tr class="item_row" style="border-color: #F0F0F0; border-style: Solid; height: 40px;">
                            <td class="item_float">
                                <label>
                                    <input type="hidden" value="@chucnang.IdChucNang" id="Id"/>
                                    @chucnang.IdChucNang
                                </label>
                            </td>
                            <td class="item_float">
                                <label>
                                    <input type="hidden" value="@chucnang.TenChucNang" id="Ten"/>
                                    @chucnang.TenChucNang
                                </label>
                            </td>
                            <td class="item_float">
                                <label>
                                    <input type="hidden" value="@chucnang.MaChucNang" id="Code"/>
                                    @chucnang.MaChucNang
                                </label>
                            </td>
                            <td class="td-actions">
                                <div class="hidden-phone visible-desktop action-buttons">
                                    <a href="#" class="btn btn-info btnSua">
                                        <i class="icon-edit icon-white"></i>
                                        Sửa
                                    </a>
                                    <script>
                                        $('.btnSua').click(function () {
                                            var tr = $(this).parents('tr:first');
                                            var ten = tr.find("#Ten").val();
                                            var Id = tr.find("#Id").val();
                                            var Code = tr.find("#Code").val();
                                            $("#txtTen").val(ten);
                                            $("#txtTen").focus();
                                            $("#txtID").val(Id);
                                            $("#txtCode").val(Code);
                                        });
                                    </script>
                                </div>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
            <div class="pagination pagination-centered">
                @Html.PagedListPager((IPagedList)ViewBag.OnePage, page => Url.Action("ChucNang", new { page }), PagedListRenderOptions.OnlyShowFivePagesAtATime)
            </div>

        </div>
    </div>
</div>






